
package com.example.controlexercise;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class login extends switchTest {

    private EditText account,password;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
    }

    public void loginAccount(View view){
        account = findViewById(R.id.account1);
        password = findViewById(R.id.password);
        String acc =sharedPreferences.getString("account","");
        String pws = sharedPreferences.getString("password","");
        if (account.getText().equals(acc)){
            if (password.getText().equals(pws)){
                Toast.makeText(login.this,"登录成功",Toast.LENGTH_SHORT).show();
            }
        }
    }
}